package com.cskaoyan.util;

import com.cskaoyan.bean.pojo.MallSystem;
import com.cskaoyan.bean.pojo.MallSystemExample;
import com.cskaoyan.mapper.MallSystemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author: Fengyi
 * @description: 配置管理信息
 * @time: 2021/7/13 17:38
 */
@Component
public class MySystemUtil {

    @Autowired
    MallSystemMapper mallSystemMapper;

    public Map<String, String> systemMap() {
        HashMap<String, String> systemMap = new HashMap<>();
        MallSystemExample mallSystemExample = new MallSystemExample();
        MallSystemExample.Criteria criteria = mallSystemExample.createCriteria();
        criteria.andDeletedEqualTo(false);
        List<MallSystem> mallSystems = mallSystemMapper.selectByExample(mallSystemExample);

        for (MallSystem mallSystem : mallSystems) {
            systemMap.put(mallSystem.getKeyName(), mallSystem.getKeyValue());
        }

        return systemMap;
    }
}
